let dataInfo = [{
    name: "安东尼 戴维斯",
    money: 892001
},
{
    name: "凯里 欧文",
    money: 668932
},
{
    name: "史蒂夫 库里",
    money: 698756
},
{
    name: "德里克 罗斯",
    money: 492489
},
{
    name: "保罗 乔治",
    money: 853957
},
{
    name: "勒布朗 詹姆斯",
    money: 968472
},
{
    name: "詹姆斯 哈登",
    money: 718225
},
{
    name: "凯文 杜兰特",
    money: 889147
},
];
let toggle = document.getElementById("toggle")
let body = document.querySelector("body")
let add_user = document.getElementById("add-user")
let double = document.getElementById("double");
let showMillionaire = document.getElementById("show-millionaire");

let index = 0;

//添加数据组

add_user.onclick = function () {
    // console.log(index);
    if (index < dataInfo.length) {
        let newDiv = document.createElement("div")

        newDiv.classList.add("bottom_box");

        // console.log(newDiv);
        newDiv.innerHTML =
            `<span>${dataInfo[index].name}</span>
        <span>$${dataInfo[index].money}</span>`

        main.appendChild(newDiv);


        index++;

    }
}



//鼠标点击事件
toggle.addEventListener("click", function () {
    if (!body.style.transform) {
        body.style.transform = "translate(150px)";
    } else {
        body.removeAttribute("style");
    }
})





